%name c_lang_
%token_prefix C_

%include {
    global $CFG;
    require_once($CFG->dirroot . '/blocks/formal_langs/tokens_base.php');
 }

%include_class {
    public $error;
    public $ast;
    public $success = false;

    public $dump_info = '';

    private $debug_mode = false;
    private $node_num = 0;

    public function set_debug_mode($flag) {
        $this->debug_mode = $flag;
    }

    public function dump() {
        if ($this->debug_mode) {
            ob_start();
            $this->dump_info .= "Stack dump:\n";
            var_dump($this->yystack);
            $this->dump_info .= ob_get_contents();
            ob_end_clean();

            ob_start();
            $this->dump_info .= "$this->list dump:\n";
            var_dump($this->ast);
            $this->dump_info .= ob_get_contents();
            ob_end_clean();

            ob_start();
            $this->dump_info .= "$this->error dump:\n";
            var_dump($this->error);
            $this->dump_info .= ob_get_contents();
            ob_end_clean();
        }
    }

    public function process_token($token) {
        $this->doParse($token->type(), $token);
    }
}

%parse_failure {
    if ($this->debug_mode) {
        $this->dump_info .= "Parsing error.\n";
        $this->dump();
    }
    $this->success = false;
}

%parse_accept {
    if ($this->debug_mode) {
        $this->dump_info .= "Parsing done.\n";
        $this->dump();
    }
    $this->success = true;
}

%syntax_error {
    if ($this->debug_mode) {
        $this->dump_info .= "Syntax error.\n";
    }
}

/* this defines a symbol for the lexer */
%nonassoc PRAGMA.

 /* the precedence of IF/ELSE solves the dangling else conflict */
%nonassoc IF.
%nonassoc ELSE.

start ::= translation_unit(B) . { $this->ast = new block_formal_langs_ast(B); }

primary_expression(A) ::= IDENTIFIER(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("primary_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
primary_expression(A) ::= CONSTANT(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("primary_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
primary_expression(A) ::= STRING_LITERAL(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("primary_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
primary_expression(A) ::= LPAREN(B) expression(C) RPAREN(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("primary_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
primary_expression(A) ::= LPAREN(B) error(C) RPAREN(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("primary_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

postfix_expression(A) ::= primary_expression(B) . {
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
postfix_expression(A) ::= postfix_expression(B) LSQUARE(C) expression(D) RSQUARE(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
postfix_expression(A) ::= postfix_expression(B) LPAREN(C) RPAREN(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
postfix_expression(A) ::= postfix_expression(B) LPAREN(C) argument_expression_list(D) RPAREN(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
postfix_expression(A) ::= postfix_expression(B) PERIOD(C) IDENTIFIER(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
postfix_expression(A) ::= postfix_expression(B) PTR_OP(C) IDENTIFIER(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
postfix_expression(A) ::= postfix_expression(B) INC_OP(C) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
postfix_expression(A) ::= postfix_expression(B) DEC_OP(C) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("postfix_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

argument_expression_list(A) ::= assignment_expression(B) . {
    $result = new block_formal_langs_ast_node_base("argument_expression_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
argument_expression_list(A) ::= argument_expression_list(B) COMMA(C) assignment_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("argument_expression_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

unary_expression(A) ::= postfix_expression(B) . {
    $result = new block_formal_langs_ast_node_base("unary_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
unary_expression(A) ::= INC_OP(B) unary_expression(C) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
unary_expression(A) ::= DEC_OP(B) unary_expression(C) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
unary_expression(A) ::= unary_operator(B) cast_expression(C) . {
    $result = new block_formal_langs_ast_node_base("unary_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
unary_expression(A) ::= SIZEOF(B) unary_expression(C) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
unary_expression(A) ::= SIZEOF(B) LPAREN(C) type_name(D) RPAREN(E) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

unary_operator(A) ::= AMP(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
unary_operator(A) ::= STAR(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
unary_operator(A) ::= PLUS(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
unary_operator(A) ::= MINUS(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
unary_operator(A) ::= TILDE(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
unary_operator(A) ::= EXCLAM(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("unary_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

cast_expression(A) ::= unary_expression(B) . {
    $result = new block_formal_langs_ast_node_base("cast_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
cast_expression(A) ::= LPAREN(B) type_name(C) RPAREN(D) cast_expression(E) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("cast_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

multiplicative_expression(A) ::= cast_expression(B) . {
    $result = new block_formal_langs_ast_node_base("multiplicative_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
multiplicative_expression(A) ::= multiplicative_expression(B) STAR(C) cast_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("multiplicative_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
multiplicative_expression(A) ::= multiplicative_expression(B) SLASH(C) cast_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("multiplicative_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
multiplicative_expression(A) ::= multiplicative_expression(B) PERCENT(C) cast_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("multiplicative_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

additive_expression(A) ::= multiplicative_expression(B) . {
    $result = new block_formal_langs_ast_node_base("additive_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
additive_expression(A) ::= additive_expression(B) PLUS(C) multiplicative_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("additive_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
additive_expression(A) ::= additive_expression(B) MINUS(C) multiplicative_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("additive_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

shift_expression(A) ::= additive_expression(B) . {
    $result = new block_formal_langs_ast_node_base("shift_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
shift_expression(A) ::= shift_expression(B) LEFT_OP(C) additive_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("shift_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
shift_expression(A) ::= shift_expression(B) RIGHT_OP(C) additive_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("shift_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

relational_expression(A) ::= shift_expression(B) . {
    $result = new block_formal_langs_ast_node_base("relational_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
relational_expression(A) ::= relational_expression(B) LANGLE(C) shift_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("relational_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
relational_expression(A) ::= relational_expression(B) RANGLE(C) shift_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("relational_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
relational_expression(A) ::= relational_expression(B) LE_OP(C) shift_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("relational_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
relational_expression(A) ::= relational_expression(B) GE_OP(C) shift_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("relational_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

equality_expression(A) ::= relational_expression(B) . {
    $result = new block_formal_langs_ast_node_base("equality_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
equality_expression(A) ::= equality_expression(B) EQ_OP(C) relational_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("equality_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
equality_expression(A) ::= equality_expression(B) NE_OP(C) relational_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("equality_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

and_expression(A) ::= equality_expression(B) . {
    $result = new block_formal_langs_ast_node_base("and_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
and_expression(A) ::= and_expression(B) AMP(C) equality_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("and_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

exclusive_or_expression(A) ::= and_expression(B) . {
    $result = new block_formal_langs_ast_node_base("exclusive_or_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
exclusive_or_expression(A) ::= exclusive_or_expression(B) CARET(C) and_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("exclusive_or_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

inclusive_or_expression(A) ::= exclusive_or_expression(B) . {
    $result = new block_formal_langs_ast_node_base("inclusive_or_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
inclusive_or_expression(A) ::= inclusive_or_expression(B) PIPE(C) exclusive_or_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("inclusive_or_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

logical_and_expression(A) ::= inclusive_or_expression(B) . {
    $result = new block_formal_langs_ast_node_base("logical_and_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
logical_and_expression(A) ::= logical_and_expression(B) AND_OP(C) inclusive_or_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("logical_and_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

logical_or_expression(A) ::= logical_and_expression(B) . {
    $result = new block_formal_langs_ast_node_base("logical_or_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
logical_or_expression(A) ::= logical_or_expression(B) OR_OP(C) logical_and_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("logical_or_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

conditional_expression(A) ::= logical_or_expression(B) . {
    $result = new block_formal_langs_ast_node_base("conditional_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
conditional_expression(A) ::= logical_or_expression(B) QUESTION(C) expression(D) COLON(E) conditional_expression(F) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("conditional_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

assignment_expression(A) ::= conditional_expression(B) . {
    $result = new block_formal_langs_ast_node_base("assignment_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_expression(A) ::= unary_expression(B) assignment_operator(C) assignment_expression(D) . {
    $result = new block_formal_langs_ast_node_base("assignment_expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

assignment_operator(A) ::= EQUALS(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= MUL_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= DIV_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= MOD_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= ADD_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= SUB_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= LEFT_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= RIGHT_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= AND_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= XOR_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
assignment_operator(A) ::= OR_ASSIGN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("assignment_operator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

expression(A) ::= assignment_expression(B) . {
    $result = new block_formal_langs_ast_node_base("expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
expression(A) ::= expression(B) COMMA(C) assignment_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("expression", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

constant_expression(A) ::= conditional_expression(B) . {
    $result = new block_formal_langs_ast_node_base("constant_expression", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

declaration(A) ::= declaration_specifiers(B) SEMIC(C) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("declaration", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
declaration(A) ::= declaration_specifiers(B) init_declarator_list(C) SEMIC(D) . {
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("declaration", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
declaration(A) ::= error(B) SEMIC(C) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("declaration", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
declaration(A) ::= error(B) RCURLY(C) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("declaration", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

declaration_specifiers(A) ::= storage_class_specifier(B) . {
    $result = new block_formal_langs_ast_node_base("declaration_specifiers", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
declaration_specifiers(A) ::= storage_class_specifier(B) declaration_specifiers(C) . {
    $result = new block_formal_langs_ast_node_base("declaration_specifiers", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
declaration_specifiers(A) ::= type_specifier(B) . {
    $result = new block_formal_langs_ast_node_base("declaration_specifiers", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
declaration_specifiers(A) ::= type_specifier(B) declaration_specifiers(C) . {
    $result = new block_formal_langs_ast_node_base("declaration_specifiers", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
declaration_specifiers(A) ::= type_qualifier(B) . {
    $result = new block_formal_langs_ast_node_base("declaration_specifiers", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
declaration_specifiers(A) ::= type_qualifier(B) declaration_specifiers(C) . {
    $result = new block_formal_langs_ast_node_base("declaration_specifiers", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

init_declarator_list(A) ::= init_declarator(B) . {
    $result = new block_formal_langs_ast_node_base("init_declarator_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
init_declarator_list(A) ::= init_declarator_list(B) COMMA(C) init_declarator(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("init_declarator_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

init_declarator(A) ::= declarator(B) . {
    $result = new block_formal_langs_ast_node_base("init_declarator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
init_declarator(A) ::= declarator(B) EQUALS(C) initializer(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("init_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

storage_class_specifier(A) ::= TYPEDEF(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("storage_class_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
storage_class_specifier(A) ::= EXTERN(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("storage_class_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
storage_class_specifier(A) ::= STATIC(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("storage_class_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
storage_class_specifier(A) ::= AUTO(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("storage_class_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
storage_class_specifier(A) ::= REGISTER(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("storage_class_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

type_specifier(A) ::= VOID(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= CHAR(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= SHORT(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= INT(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= LONG(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= FLOAT(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= DOUBLE(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= SIGNED(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= UNSIGNED(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= struct_or_union_specifier(B) . {
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= enum_specifier(B) . {
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_specifier(A) ::= TYPE_NAME(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_specifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

struct_or_union_specifier(A) ::= struct_or_union(B) IDENTIFIER(C) LCURLY(D) struct_declaration_list(E) RCURLY(F) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    F->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_or_union_specifier", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
struct_or_union_specifier(A) ::= struct_or_union(B) LCURLY(C) struct_declaration_list(D) RCURLY(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_or_union_specifier", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
struct_or_union_specifier(A) ::= struct_or_union(B) IDENTIFIER(C) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_or_union_specifier", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

struct_or_union(A) ::= STRUCT(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_or_union", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
struct_or_union(A) ::= UNION(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_or_union", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

struct_declaration_list(A) ::= struct_declaration(B) . {
    $result = new block_formal_langs_ast_node_base("struct_declaration_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
struct_declaration_list(A) ::= struct_declaration_list(B) struct_declaration(C) . {
    $result = new block_formal_langs_ast_node_base("struct_declaration_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

struct_declaration(A) ::= specifier_qualifier_list(B) struct_declarator_list(C) SEMIC(D) . {
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_declaration", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

specifier_qualifier_list(A) ::= type_specifier(B) specifier_qualifier_list(C) . {
    $result = new block_formal_langs_ast_node_base("specifier_qualifier_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
specifier_qualifier_list(A) ::= type_specifier(B) . {
    $result = new block_formal_langs_ast_node_base("specifier_qualifier_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
specifier_qualifier_list(A) ::= type_qualifier(B) specifier_qualifier_list(C) . {
    $result = new block_formal_langs_ast_node_base("specifier_qualifier_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
specifier_qualifier_list(A) ::= type_qualifier(B) . {
    $result = new block_formal_langs_ast_node_base("specifier_qualifier_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

struct_declarator_list(A) ::= struct_declarator(B) . {
    $result = new block_formal_langs_ast_node_base("struct_declarator_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
struct_declarator_list(A) ::= struct_declarator_list(B) COMMA(C) struct_declarator(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_declarator_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

struct_declarator(A) ::= declarator(B) . {
    $result = new block_formal_langs_ast_node_base("struct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
struct_declarator(A) ::= COLON(B) constant_expression(C) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
struct_declarator(A) ::= declarator(B) COLON(C) constant_expression(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("struct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

enum_specifier(A) ::= ENUM(B) LCURLY(C) enumerator_list(D) RCURLY(E) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("enum_specifier", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
enum_specifier(A) ::= ENUM(B) IDENTIFIER(C) LCURLY(D) enumerator_list(E) RCURLY(F) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    F->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("enum_specifier", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
enum_specifier(A) ::= ENUM(B) IDENTIFIER(C) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("enum_specifier", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

enumerator_list(A) ::= enumerator(B) . {
    $result = new block_formal_langs_ast_node_base("enumerator_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
enumerator_list(A) ::= enumerator_list(B) COMMA(C) enumerator(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("enumerator_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

enumerator(A) ::= IDENTIFIER(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("enumerator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
enumerator(A) ::= IDENTIFIER(B) EQUALS(C) constant_expression(D) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("enumerator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

type_qualifier(A) ::= CONST(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_qualifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_qualifier(A) ::= VOLATILE(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("type_qualifier", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

declarator(A) ::= pointer(B) direct_declarator(C) . {
    $result = new block_formal_langs_ast_node_base("declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
declarator(A) ::= direct_declarator(B) . {
    $result = new block_formal_langs_ast_node_base("declarator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

direct_declarator(A) ::= IDENTIFIER(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
direct_declarator(A) ::= LPAREN(B) declarator(C) RPAREN(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_declarator(A) ::= direct_declarator(B) LSQUARE(C) constant_expression(D) RSQUARE(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_declarator(A) ::= direct_declarator(B) LSQUARE(C) RSQUARE(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_declarator(A) ::= direct_declarator(B) LPAREN(C) parameter_type_list(D) RPAREN(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_declarator(A) ::= direct_declarator(B) LPAREN(C) identifier_list(D) RPAREN(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_declarator(A) ::= direct_declarator(B) LPAREN(C) RPAREN(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

pointer(A) ::= STAR(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("pointer", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
pointer(A) ::= STAR(B) type_qualifier_list(C) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("pointer", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
pointer(A) ::= STAR(B) pointer(C) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("pointer", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
pointer(A) ::= STAR(B) type_qualifier_list(C) pointer(D) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("pointer", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

type_qualifier_list(A) ::= type_qualifier(B) . {
    $result = new block_formal_langs_ast_node_base("type_qualifier_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_qualifier_list(A) ::= type_qualifier_list(B) type_qualifier(C) . {
    $result = new block_formal_langs_ast_node_base("type_qualifier_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

parameter_type_list(A) ::= parameter_list(B) . {
    $result = new block_formal_langs_ast_node_base("parameter_type_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
parameter_type_list(A) ::= parameter_list(B) COMMA(C) ELLIPSIS(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("parameter_type_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

parameter_list(A) ::= parameter_declaration(B) . {
    $result = new block_formal_langs_ast_node_base("parameter_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
parameter_list(A) ::= parameter_list(B) COMMA(C) parameter_declaration(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("parameter_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

parameter_declaration(A) ::= declaration_specifiers(B) declarator(C) . {
    $result = new block_formal_langs_ast_node_base("parameter_declaration", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
parameter_declaration(A) ::= declaration_specifiers(B) abstract_declarator(C) . {
    $result = new block_formal_langs_ast_node_base("parameter_declaration", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
parameter_declaration(A) ::= declaration_specifiers(B) . {
    $result = new block_formal_langs_ast_node_base("parameter_declaration", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

identifier_list(A) ::= IDENTIFIER(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("identifier_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
identifier_list(A) ::= identifier_list(B) COMMA(C) IDENTIFIER(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("identifier_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

type_name(A) ::= specifier_qualifier_list(B) . {
    $result = new block_formal_langs_ast_node_base("type_name", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
type_name(A) ::= specifier_qualifier_list(B) abstract_declarator(C) . {
    $result = new block_formal_langs_ast_node_base("type_name", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

abstract_declarator(A) ::= pointer(B) . {
    $result = new block_formal_langs_ast_node_base("abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
abstract_declarator(A) ::= direct_abstract_declarator(B) . {
    $result = new block_formal_langs_ast_node_base("abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
abstract_declarator(A) ::= pointer(B) direct_abstract_declarator(C) . {
    $result = new block_formal_langs_ast_node_base("abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

direct_abstract_declarator(A) ::= LPAREN(B) abstract_declarator(C) RPAREN(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= LSQUARE(B) RSQUARE(C) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= LSQUARE(B) constant_expression(C) RSQUARE(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= direct_abstract_declarator(B) LSQUARE(C) RSQUARE(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= direct_abstract_declarator(B) LSQUARE(C) constant_expression(D) RSQUARE(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= LPAREN(B) RPAREN(C) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= LPAREN(B) parameter_type_list(C) RPAREN(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= direct_abstract_declarator(B) LPAREN(C) RPAREN(D) . {
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
direct_abstract_declarator(A) ::= direct_abstract_declarator(B) LPAREN(C) parameter_type_list(D) RPAREN(E) . {
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("direct_abstract_declarator", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

initializer(A) ::= assignment_expression(B) . {
    $result = new block_formal_langs_ast_node_base("initializer", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
initializer(A) ::= LCURLY(B) initializer_list(C) RCURLY(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("initializer", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
initializer(A) ::= LCURLY(B) initializer_list(C) COMMA(D) RCURLY(E) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("initializer", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

initializer_list(A) ::= initializer(B) . {
    $result = new block_formal_langs_ast_node_base("initializer_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
initializer_list(A) ::= initializer_list(B) COMMA(C) initializer(D) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("initializer_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

statement(A) ::= labeled_statement(B) . {
    $result = new block_formal_langs_ast_node_base("statement", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
statement(A) ::= compound_statement(B) . {
    $result = new block_formal_langs_ast_node_base("statement", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
statement(A) ::= expression_statement(B) . {
    $result = new block_formal_langs_ast_node_base("statement", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
statement(A) ::= selection_statement(B) . {
    $result = new block_formal_langs_ast_node_base("statement", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
statement(A) ::= iteration_statement(B) . {
    $result = new block_formal_langs_ast_node_base("statement", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
statement(A) ::= jump_statement(B) . {
    $result = new block_formal_langs_ast_node_base("statement", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

labeled_statement(A) ::= IDENTIFIER(B) COLON(C) statement(D) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("labeled_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
labeled_statement(A) ::= CASE(B) constant_expression(C) COLON(D) statement(E) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("labeled_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
labeled_statement(A) ::= DEFAULT(B) COLON(C) statement(D) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("labeled_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

compound_statement(A) ::= LCURLY(B) RCURLY(C) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("compound_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
compound_statement(A) ::= LCURLY(B) statement_list(C) RCURLY(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("compound_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
compound_statement(A) ::= LCURLY(B) declaration_list(C) RCURLY(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("compound_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
compound_statement(A) ::= LCURLY(B) declaration_list(C) statement_list(D) RCURLY(E) . {
    B->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("compound_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

declaration_list(A) ::= declaration(B) . {
    $result = new block_formal_langs_ast_node_base("declaration_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
declaration_list(A) ::= declaration_list(B) declaration(C) . {
    $result = new block_formal_langs_ast_node_base("declaration_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

statement_list(A) ::= statement(B) . {
    $result = new block_formal_langs_ast_node_base("statement_list", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
statement_list(A) ::= statement_list(B) statement(C) . {
    $result = new block_formal_langs_ast_node_base("statement_list", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

expression_statement(A) ::= SEMIC(B) . {
    B->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("expression_statement", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
expression_statement(A) ::= expression(B) SEMIC(C) . {
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("expression_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

selection_statement(A) ::= IF(B) LPAREN(C) expression(D) RPAREN(E) statement(F) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("selection_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
selection_statement(A) ::= IF(B) LPAREN(C) expression(D) RPAREN(E) statement(F) ELSE(G) statement(H) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    G->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("selection_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $result->add_child(G);
    $result->add_child(H);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position(), G->position(), H->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
selection_statement(A) ::= SWITCH(B) LPAREN(C) expression(D) RPAREN(E) statement(F) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("selection_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

iteration_statement(A) ::= WHILE(B) LPAREN(C) expression(D) RPAREN(E) statement(F) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    E->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("iteration_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
iteration_statement(A) ::= DO(B) statement(C) WHILE(D) LPAREN(E) expression(F) RPAREN(G) SEMIC(H) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    E->set_number($this->node_num++);
    G->set_number($this->node_num++);
    H->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("iteration_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $result->add_child(G);
    $result->add_child(H);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position(), G->position(), H->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
iteration_statement(A) ::= FOR(B) LPAREN(C) expression_statement(D) expression_statement(E) RPAREN(F) statement(G) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    F->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("iteration_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $result->add_child(G);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position(), G->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
iteration_statement(A) ::= FOR(B) LPAREN(C) expression_statement(D) expression_statement(E) expression(F) RPAREN(G) statement(H) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    G->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("iteration_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $result->add_child(F);
    $result->add_child(G);
    $result->add_child(H);
    $positions = array(B->position(), C->position(), D->position(), E->position(), F->position(), G->position(), H->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

jump_statement(A) ::= GOTO(B) IDENTIFIER(C) SEMIC(D) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("jump_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
jump_statement(A) ::= CONTINUE(B) SEMIC(C) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("jump_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
jump_statement(A) ::= BREAK(B) SEMIC(C) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("jump_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
jump_statement(A) ::= RETURN(B) SEMIC(C) . {
    B->set_number($this->node_num++);
    C->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("jump_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
jump_statement(A) ::= RETURN(B) expression(C) SEMIC(D) . {
    B->set_number($this->node_num++);
    D->set_number($this->node_num++);
    $result = new block_formal_langs_ast_node_base("jump_statement", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

translation_unit(A) ::= external_declaration(B) . {
    $result = new block_formal_langs_ast_node_base("translation_unit", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
translation_unit(A) ::= translation_unit(B) external_declaration(C) . {
    $result = new block_formal_langs_ast_node_base("translation_unit", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}

external_declaration(A) ::= function_definition(B) . {
    $result = new block_formal_langs_ast_node_base("external_declaration", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}
external_declaration(A) ::= declaration(B) . {
    $result = new block_formal_langs_ast_node_base("external_declaration", $this->node_num++);
    $result->add_child(B);
    $result->set_position(B->position());
    A = $result;
}

function_definition(A) ::= declaration_specifiers(B) declarator(C) declaration_list(D) compound_statement(E) . {
    $result = new block_formal_langs_ast_node_base("function_definition", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $result->add_child(E);
    $positions = array(B->position(), C->position(), D->position(), E->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
function_definition(A) ::= declaration_specifiers(B) declarator(C) compound_statement(D) . {
    $result = new block_formal_langs_ast_node_base("function_definition", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
function_definition(A) ::= declarator(B) declaration_list(C) compound_statement(D) . {
    $result = new block_formal_langs_ast_node_base("function_definition", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $result->add_child(D);
    $positions = array(B->position(), C->position(), D->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
function_definition(A) ::= declarator(B) compound_statement(C) . {
    $result = new block_formal_langs_ast_node_base("function_definition", $this->node_num++);
    $result->add_child(B);
    $result->add_child(C);
    $positions = array(B->position(), C->position());
    $result->set_position(block_formal_langs_node_position::summ($positions));
    A = $result;
}
